import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/login',
    name: '登录',
    meta: {
      hidden: true,
    },
    component: () => import('../view/Login.vue')
  },

  {
    path: '/',
    name: '首页',
    meta: {
      icon: 'Setting',
      parent: true,
    },
    redirect: '/home',
    component: () => import('../view/Layout.vue'),
    children: [
      {
        path: '/home',
        name: '主页',
        meta: {
          icon: 'Home'
        },
        component: () => import('../view/home/HomePage.vue'),
      },
    ]
  },
  {
    path: '/system',
    name: '系统管理',
    meta: {
      icon: 'Setting',
      parent: true,
    },
    redirect: '/system/SystemUserManagement',
    component: () => import('../view/Layout.vue'),
    children: [
      {
        path: '/system/SystemUserManagement',
        name: '系统用户管理',
        meta: {
          icon: 'Setting'
        },
        component: () => import('../view/system/SystemUserManagement.vue'),
      },
      {
        path: '/system/SystemRoleManagement',
        name: '系统角色管理',
        meta: {
          icon: 'Setting'
        },
        component: () => import('../view/system/SystemRoleManagement.vue'),
      },
      {
        path: '/system/SysAuthorityManagement',
        name: '系统权限管理',
        meta: {
          icon: 'Setting'
        },
        component: () => import('../view/system/SystemAuthorityManagement.vue'),
      },
    ]
  },
  {
    path: '/blog',
    name: '博客管理',
    meta: {
      icon: 'Setting',
      parent: true,
    },
    redirect: '/blog/BlogManagement',
    component: () => import('../view/Layout.vue'),
    children: [
      {
        path: '/blog/BlogManagement',
        name: '博客管理',
        meta: {
          icon: 'Setting'
        },
        component: () => import('../view/blog/BlogManagement.vue'),
      },
      {
        path: '/blog/ArticleManagement',
        name: '文章管理',
        meta: {
          icon: 'Setting'
        },
        component: () => import('../view/blog/ArticleManagement.vue'),
      },
    ]
  },
  {
    path: '/:pathMatch(.*)*',
    name: 'NotFound',
    meta: {
      hidden: true,
    },
    component: () => import('../view/NotFound.vue')
  },

]


const router = createRouter({
  history: createWebHashHistory(),
  routes,
})

export default router;